﻿using IceDog.Uop.IRepositories;
using IceDog.Uop.Models;
using IceDog.Uop.Models.Context;
using System;
using System.Collections.Generic;
using System.Linq;

namespace IceDog.Uop.Repositories
{
    public class UserRepository : IUserRepository
    {
        private readonly UopContext _context;
        public UserRepository(UopContext context)
        {
            _context = context;
        }
        public string Add(User entity)
        {
             _context.Users.Add(entity);
            int saveResult = _context.SaveChanges();
            return entity.Id.ToString(); ;
        }

        public User Select(uint id)
        {
            var user =  _context.Users.Find(id);
            return user;
        }

        public List<User> SelectAll()
        {
            var users = _context.Users.ToList();
            return users;
        }

        public void Update(User entity)
        {
            throw new NotImplementedException();
        }
    }
}
